//Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Eas.WebCrawler.Model.Core;

namespace Eas.WebCrawler.Test.Model {
    /// <summary>
    /// Summary description for InvalidTerminalActionOperationTests
    /// </summary>
    [TestClass]
    public class InvalidTerminalActionOperationTests {
        public InvalidTerminalActionOperationTests() {
            //
            // TODO: Add constructor logic here
            //
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //

        WorkerContext _Context = null;
        BaseProcessingState _State = null;
        Eas.WebCrawler.Model.Actions.ProcessingAction _Action = null;


        // Use TestInitialize to run code before running each test 
        [TestInitialize()]
        public void MyTestInitialize() {
            _Context = Eas.WebCrawler.Model.WebCrawlerFactory.CreateWorkerContext(new TestSettings(), new Eas.WebCrawler.Model.Gateway.BaseWebGateway(), new Eas.WebCrawler.Model.Actions.BaseActionFactory());
            _State = _Context.StateTracker[0];
            _Action = _Context.ActionFactory.CreateTerminalAction(_State, _Context);
        }
        //
        // Use TestCleanup to run code after each test has run
        [TestCleanup()]
        public void MyTestCleanup() {
            _Action = null;
            _State = null;
            _Context.Dispose();
            _Context = null;
        }

        //
        #endregion

        [TestMethod]
        [ExpectedException(typeof(System.InvalidOperationException))]
        /// <summary>Executes the TestEndAction test, in which the <seealso cref="System.InvalidOperationException"/> exception should be thrown during a succesfull test run.</summary>
        public void TestEndAction() {
            _Action.EndAction(_Context, _State, null);
        }

        [TestMethod]
        [ExpectedException(typeof(System.InvalidOperationException))]
        /// <summary>Executes the TestPerformCompletingAction test, in which the <seealso cref="System.InvalidOperationException"/> exception should be thrown during a succesfull test run.</summary>
        public void TestPerformCompletingAction() {
            _Action.PerformCompletingAction(_Context, _State, null);
        }




    }
}
